In the messaging domain there are two basic models for exchanging of data between applications: (i) point to point; and (ii) publish/subscribe (pub/sub) model. In a point to point model system, a queue acts as a central point to which producers send messages and consumers connected to this queue retrieve messages. In the pub/sub model, a “topic” is an organizing construct. In pub/sub, publishers and subscribers connect to a topic to produce and consume messages. One difference between point to point model system and pub/sub model system is that: (i) in a pub/sub model system, multiple subscribers subscribe to a given topic and every message published to the topic will be “federated” to all the subscribers of that given topic (subject to validation and message selector criteria); whereas (ii) in a point to point model system, only a designated consumer will consume any message and the message is not automatically duplicated or federated across multiple consumers.
The pub/sub model supports two types of subscriptions: (i) durable; and (ii) non-durable. A non-durable subscriber is very much specific to its connection. That is, subsequent to a loss, or closure, of the connection over which the non-durable subscription was created: (i) the non-durable subscriber is automatically de-registered/removed; and (ii) all the messages for that non-durable subscriber that were unconsumed are discarded by the messaging engine. In the case of the durable subscriber, the messaging engine keeps all unconsumed messages of a durable subscriber until the durable subscriber consumes them. A durable subscriber, once registered, can connect to the topic anytime and disconnect any time because it is the responsibility of the messaging engine to persist all the messages published on a particular topic during interval(s) when the subscriber is inactive. Once the subscriber reconnects, the messaging engine will deliver all the stored messages to the subscriber. Once the subscriber consumes the messages, the messaging engine will remove that message from its persistence layer.